package team.stride.tabs.home;

import java.util.List;

import team.stride.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class TrackListViewItemAdapter extends BaseAdapter/*
														 * implements
														 * OnClickListener
														 */{
	private Context context;

	private List<TrackListViewItem> tracks;

	public TrackListViewItemAdapter(Context context,
			List<TrackListViewItem> tracks) {
		this.context = context;
		this.tracks = tracks;
	}

	public int getCount() {
		return tracks.size();
	}

	public Object getItem(int position) {
		return tracks.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup viewGroup) {
		TrackListViewItem entry = tracks.get(position);
		if (convertView == null) {
			LayoutInflater inflater = (LayoutInflater) context
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView = inflater.inflate(R.layout.track_name_row, null);
		}
		TextView tvName = (TextView) convertView.findViewById(R.id.tvName);
		tvName.setText(entry.getName());
		return convertView;
	}

	// @Override
	// public void onClick(View view) {
	// TrackListViewItem entry = (TrackListViewItem) view.getTag();
	// UtilsStride.trackName = entry.getName();
	// notifyDataSetChanged();
	// }

}
